package org.paradise.dms.web.tools;

import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;

import org.springframework.beans.factory.BeanFactory;

/**
 * 
 * Description: 项目的总配置文件。
 * 
 * Copyright (c) 2008-2009 paraDise sTudio(DT). All Rights Reserved.
 * 
 * @version 1.0 2009-3-20 下午09:54:56 李双江（paradise.lsj@gmail.com）created
 */
@SuppressWarnings("unchecked")
public class ServerConfig {
	private static BeanFactory beanFacotry;
	private static ConcurrentHashMap<String, Object> attributes = new ConcurrentHashMap<String, Object>();
	private static String systemName = "";

	/**
	 * 系统VO的全列表
	 */
	public static ArrayList<Class> serverVoList = new ArrayList<Class>();

	/**
	 * 获得beanFacotry
	 * 
	 * @return
	 */
	public static BeanFactory getBeanFacotry() {
		return beanFacotry;
	}

	public static void setBeanFacotry(BeanFactory beanFacotry) {
		ServerConfig.beanFacotry = beanFacotry;
	}

	/**
	 * 
	 * Description:获得所有服务器属性的 ConcurrentHashMap
	 * 
	 * @Version1.0 2009-3-20 下午09:55:25 李双江（paradise.lsj@gmail.com）创建
	 * @return
	 */
	public static ConcurrentHashMap<String, Object> getAttributes() {
		return attributes;
	}

	/**
	 * 
	 * Description:放置服务器属性
	 * 
	 * @Version1.0 2009-3-20 下午09:55:33 李双江（paradise.lsj@gmail.com）创建
	 * @param key
	 * @param value
	 */
	public static void putAttributes(String key, Object value) {
		attributes.put(key, value);
	}

	/**
	 * 
	 * Description: 判断某个主键是否在属性列表中
	 * 
	 * @Version1.0 2009-3-20 下午09:55:41 李双江（paradise.lsj@gmail.com）创建
	 * @param key
	 * @return
	 */
	public static boolean containsAttributeKey(String key) {
		return attributes.containsKey(key);
	}

	/**
	 * 
	 * Description:根据key来取得某个属性
	 * 
	 * @Version1.0 2009-3-20 下午09:55:49 李双江（paradise.lsj@gmail.com）创建
	 * @param key
	 * @return
	 */
	public static Object getAttribute(String key) {
		return attributes.get(key);
	}

	public static String getSystemName() {
		return systemName;
	}

	public static void setSystemName(String systemName) {
		ServerConfig.systemName = systemName;
	}
}
